//
//  HSBaseViewController.m
//  HSTS
//
//  Created by simon on 2017/1/23.
//  Copyright © 2017年 simon. All rights reserved.
//

#import "HSBaseViewController.h"
#import "AppDelegate.h"
@interface HSBaseViewController ()

@end

@implementation HSBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = KGLOBLEBGCOLOR;
    
    // 设置导航栏颜色
    [self setupNav];
    
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];//enableAutoToolbar
    AppDelegate *delegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
    delegate.currentVC = self;
    [[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];

}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    AppDelegate *delegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
    delegate.currentVC = nil;
}

- (void)setupNav
{
    UINavigationBar *bar = [UINavigationBar appearance];
    [bar setBarTintColor:HSMColor(0.86, 0.85, 0.81)];
    [bar setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:22],NSForegroundColorAttributeName :HSMColor(0.47, 0.40, 0.36)}];
}

-(void)initBackButton
{
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrowdleft"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    leftBarButtonItem.tintColor = [UIColor lightGrayColor];
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                                       initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                       target:nil action:nil];
    negativeSpacer.width = 10;
    self.navigationItem.leftBarButtonItems = @[negativeSpacer,leftBarButtonItem];
}


- (void)initRightButton{
    
}

-(void)initLeftButton{
    
}


- (void)rightBtnClick:(UIButton*)button
{

}
-(void)leftBtnClick:(UIButton *)button{
}
-(void)back
{
    if(self.navigationController){
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
